import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from modules import runmodel, envelope


protocol = pd.read_csv('../HYSTapp/HYSTresult.csv')
params = [980., 1.0, 0.04, 350., 0.6, 1.05, 0.05, 0.6, 13., 1230., 0.075, 0.015]
for no in set(protocol['No']):
    # if no != 5.2:
    #     continue
    p = protocol[protocol['No']==no]
    disps = p['Disp(mm)']
    forces = runmodel(params, p['Disp(mm)'])
    plt.figure()
    plt.plot(p['Disp(mm)'], p['Force(kN)']*1000, label='HYST')
    plt.plot(p['Disp(mm)'], forces, label="DowelType")
    plt.legend(loc='lower right', fontsize='small')
    plt.savefig(f'../HYSTapp/Calibration{no}.png', dpi=120)
